<!-- 顶部 -->
<link rel="stylesheet" href="./resource/css/ypt_s_showBo.css">
<?php
#首页分类
$info = ShopService::instance()->CatesList();
foreach($info as $key =>$value){
    $isess=ShopService::instance()->SelectCategory($value->c_id,$value->fid);
    foreach($isess as $k =>&$v ){
        $isess[$k]->sance=ShopService::instance()->SelectCategorys($v->c_id);
    }
    unset($v);
    $value->cat_name=$isess;
    $info[$key]=$value;
}
#导航栏
$daohang = ShopService::instance()->CatesList();
$user_id = session_get(UserEnum::USER_INFO_USER_ID);
$user_info = session_get(UserEnum::USER_INFO_SESSION_KEY);
?>
<div class="head">
    <div class="top-nav">
        <div class="main">
            <div class="left">
                <span>您好，欢迎来到央票通！</span>
                <!-- 未登录 -->
                <?php if(empty($user_id)){?>
                <a href="/login" class="a-login">请登录</a>
                <?php }else{?>
                        <!-- 登录后 -->
                <span class="login-after">
                    <a href="javascript:;">
                        您好，   @if(preg_match('/^1[34578]\d{9}$/',session_get(UserEnum::USER_INFO_USER_NAME)))
                            {{substr_replace($user_info->mobile,'****',3,4)}}
                        @else
                            {{$user_info->user_name}}
                        @endif
                    </a>
                      <a href="javascript:;" onclick="Loginout()">退出</a>
                </span>
                <?php }?>
                <a href="/register" class="a-register">免费注册</a>
            </div>
            <div class="right">
                <ul>
                    <li><a href="/">央票通首页</a><span>|</span></li>
                    <!-- <li><a href="javascript:;">我的订单</a><span>|</span></li> -->
                    <li><a href="javascript:;">在线客服</a><span>|</span></li>
                    <li><span class="last">客服热线：180-1866-7777</span></li>
                </ul>
            </div>
        </div>
    </div>
    <div class="top">
        <div class="main">
            <div class="logo left">
                <a href="/ypt_shop_index"><img src="./resource/img/logo_shop.png" alt=""></a>
            </div>
            <div class="form left">

                <form action="/ypt_shop_list" method="post">
                    @if(!empty($keywords))
                        <input type="text" placeholder="请输入关键字" class="form-input" name="keywords" value="{{$keywords}}">
                    @else
                        <input type="text" placeholder="请输入关键字" class="form-input" name="keywords" >
                    @endif
                    <button type="submit">搜索</button>
                </form>
            </div>
            <div class="right shopping">
                <i class="shop-ico"></i>
                @if(empty($user_id))
                    <a href="javascript:;" class="a_login">我的购物车 <span></span></a>
                @else
                    <a href="/ypt_shop_list">我的购物车 <span></span></a>
                @endif
            </div>

        </div>
    </div>
</div>
<!-- 导航 -->
<div class="nav">
    <div class="main">
        <div class="nav-all left" rel="show">
            <div class="all-tit">
                <i></i>
                <a href="javascript:;">商品分类</a>
                <span></span>
            </div>
            <div class="all-wrap">
                <ul>

                        @foreach($info as $k => $b)
                    <li class="wrap-list">
                        <div class="list-t">
                            <a href="javascript:;">
                                <i></i>
                                <span>{{$b->cate_name}}</span>
                                <span class="right">&#62</span>
                            </a>
                        </div>
                                <div class="list-con">
                                    @foreach($b->cat_name as $key)
                                    <a href="/ypt_shop_list?c_id={{$key->c_id}}">{{$key->cate_name}}</a>
                                    @endforeach
                                </div>
                        <div class="list-right">
                            @foreach($b->cat_name as $key)
                                <?php if(empty($key->sance)){?>

                                <?php }else{?>
                                    <div class="clear two-t"> {{$key->cate_name}}</div>
                                <?php }?>
                            @foreach($key->sance as $k)
                            <a href="/ypt_shop_list?c_id={{$k->c_id}}">{{$k->cate_name}}</a>
                            @endforeach
                            @endforeach
                        </div>

                    </li>
                        @endforeach
                </ul>
            </div>
        </div>
        <div class="nav-ul left">
            <ul>
                <li><a href="/ypt_shop_index">首页</a></li>
                {{--<li><a href="/ypt_business_list">商家</a></li>--}}
                @foreach($daohang as $k => $v)
                    <li <?php if($v->cate_name=='木材'){?>  class="active"<?php }?>><a href="/ypt_shop_list?business=business&c_id={{$v->c_id}}">{{$v->cate_name}}</a></li>
                @endforeach
                    <li><a href="javascript:;">手机客户端</a></li>
            </ul>
        </div>
    </div>
</div>
<script src="./resource/js/jquery-1.11.3.min.js"></script>
<script src="./resource/js/ypt_s_showBo.js"></script>
<script>

   function Loginout(){
        alert("确定退出");
       window.location.href='/login_out';
    }

    $(function(){
        $('.a_login').click(function(){
            Showbo.Msg.alert('<div style="margin-bottom: 20px;width: 200px;">请先登录</div>');
        });
    })

</script>